<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    /**
     * 转义在字面量中
     * \d代表数字1~9
     * .代表除换行外任意字符或者普通的点(如果只想表示普通点的话需要转义\.)
     */
    let price = "23@34"
    let price1 = "23.34"
    let price2 = 23.34
    console.log(/\d+\.\d+/.test(price))
    console.log(/\d+\.\d+/.test(price1))

    /**
     * 转义在对象中
     */
    console.log("\d" === "d")
    let reg = new RegExp('\\d+\\.\\d+')
    console.log(reg.test(price1))


    let url = "https://www.baidu.com"
    console.log(/https?:\/\/\w+\.\w+\.\w+/.test(url))
</script>
</html>
